package com.qiyi.player.core.video.provider.flashp2pprovider
{
   import flash.events.EventDispatcher;
   import com.qiyi.player.core.video.file.flashp2pfile.IFlashP2PFile;
   import flash.events.Event;
   import com.qiyi.player.core.video.events.ProviderEvent;
   import com.qiyi.player.core.video.decoder.IDecoder;
   
   public class FlashP2PProvider extends EventDispatcher implements IFlashP2PProvider
   {
      
      public function FlashP2PProvider(param1:IFlashP2PFile, param2:IDecoder) {
         super();
         this._file = param1;
         this._file.addEventListener("Evt_p2pFailed",this.onP2PFileFailed);
      }
      
      private var _file:IFlashP2PFile;
      
      public function get loadingFailed() : Boolean {
         if(this._file.P2P)
         {
            return this._file.P2P.loadingFailed;
         }
         return false;
      }
      
      public function get isFatal() : Boolean {
         if((this._file.P2P) && (this._file.P2P.hasOwnProperty("isFatal")))
         {
            return this._file.P2P.isFatal;
         }
         return false;
      }
      
      public function set openSelectPlay(param1:Boolean) : void {
         var var_29:Boolean = param1;
         if(this._file.P2P)
         {
            try
            {
               this._file.P2P.fragmentMode = var_29;
            }
            catch(error:Error)
            {
            }
         }
      }
      
      public function stopLoading() : void {
         if(this._file.P2P)
         {
            this._file.P2P.stopLoading();
         }
      }
      
      public function clear() : void {
      }
      
      public function prepareSwitchMediaData() : void {
      }
      
      public function retry() : void {
         if(this._file.P2P)
         {
            this._file.P2P.retry();
         }
      }
      
      public function seek(param1:int) : void {
      }
      
      public function drive() : void {
      }
      
      public function destroy() : void {
         if(this._file)
         {
            this._file.removeEventListener("Evt_p2pFailed",this.onP2PFileFailed);
            this._file = null;
         }
      }
      
      private function onP2PFileFailed(param1:Event) : void {
         dispatchEvent(new ProviderEvent(ProviderEvent.Evt_Failed));
      }
   }
}
